File manager - Edit - /home/autoph/public_html/projects/ahg-prf-api/app/Models/StockReceivingDtl.php
Back
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use OwenIt\Auditing\Contracts\Auditable; use OwenIt\Auditing\Auditable as AuditableTrait; use DB; class StockReceivingDtl extends Model implements Auditable { use HasFactory,SoftDeletes, AuditableTrait; protected $table='stock_receiving_dtls'; protected $guarded = [ 'deleted_at', ]; protected $casts = [ 'created_at' => 'datetime', 'updated_at' => 'datetime', 'deleted_at' => 'datetime', ]; public function header(){ return $this->hasOne( StockReceiving::class, 'id','str_header_id' ); // return $this->belongsTo(StockReceiving::class,'str_header_id'); } public function asset_item() { return $this->belongsTo(AssetItem::class, 'asset_item_id', 'id')->select(['id', 'name', 'uom','expense_category_id','item_classification_id','item_type_id']); //->with('expense_category','item_classification','item_type'); } public function dealer() { return $this->belongsTo(Dealership::class, 'dealer_id', 'id')->select(['id', 'code', 'name']); } public function prf_header() { return $this->belongsTo(PurchaseRequest::class, 'prf_id', 'id')->select(['id','reference_no', 'document_no','approving_head','purpose','department_id','disclaimer','created_by','needed_at']) ->with('department'); // Eager load the department relationship } // Define the one-to-one relationship with PurchaseRequestDtl public function prf_dtl_() { return $this->belongsTo(PurchaseRequestDtl::class, 'prf_dtl_id', 'id')->select('id','item_type_id'); } public function poDtl() { return $this->belongsTo(PurchaseOrderDtl::class, 'po_dtl_id', 'id'); } }
| ver. 1.4 |
.
| PHP 8.1.32 | Generation time: 0.14 |
proxy
|
phpinfo
|
Settings